//
//  MyClinicController.m
//  EcmDoctor
//
//  Created by 张进 on 15/5/29.
//  Copyright (c) 2015年 张进. All rights reserved.
//

#import "MyClinicController.h"
#import "MyClinicCardView.h"

@interface MyClinicController (){
    NSMutableArray *imageArray;//用于装需要展示的图片
    float sWidth;
    float sHeight;
}

@end

@implementation MyClinicController

@synthesize containerView;

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
    //imageArray = [[NSArray alloc] initWithObjects:@"1.jpg",@"3.jpg",@"1.jpg",@"3.jpg",@"1.jpg",@"3.jpg",@"1.jpg",@"3.jpg",nil];
    imageArray  = [[NSMutableArray alloc] initWithCapacity:0];
    [imageArray addObject:@"1.jpg"];
    [imageArray addObject:@"3.jpg"];
    [imageArray addObject:@"5.jpg"];
    [imageArray addObject:@"7.jpg"];
    
    double appWidth = [UIScreen mainScreen].applicationFrame.size.width;
    double appHeight = [UIScreen mainScreen].applicationFrame.size.height;
    
    PagedFlowView *pageFlowView = [[PagedFlowView alloc] initWithFrame:CGRectMake(0, -100, appWidth, appHeight)];
    pageFlowView.delegate = self;
    pageFlowView.dataSource = self;
    pageFlowView.minimumPageAlpha = 0.3;
    pageFlowView.minimumPageScale = 0.9;
    
    [self.containerView addSubview:pageFlowView];
//    self.view.backgroundColor = [UIColor yellowColor];
    
    
    NSLog(@"height:%f,width:%f",self.view.frame.size.height,self.view.frame.size.width);
    sWidth = self.view.frame.size.width;
    sHeight = self.view.frame.size.height;

    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
-(CGSize)sizeForPageInFlowView:(PagedFlowView *)flowView{
    return CGSizeMake(sWidth-60, sHeight-200-50);
}
-(NSInteger)numberOfPagesInFlowView:(PagedFlowView *)flowView{
    return [imageArray count];
}
-(UIView *)flowView:(PagedFlowView *)flowView cellForPageAtIndex:(NSInteger)index{
//    UIImageView *imageView = [[UIImageView alloc] init];
//    imageView.image = [UIImage imageNamed:[imageArray objectAtIndex:index]];
//    return imageView;
    
    
    MyClinicCardView *dView = [MyClinicCardView instanceDetailView];
    UIImage *targetImage = [UIImage imageNamed:[imageArray objectAtIndex:index]];
    dView.imageView.image =targetImage;
    dView.dWidth = sWidth-60;
    dView.dHeight = sHeight-200-50;
    
    return dView;
}
@end
